package LiftData;

import LiftData.Weight.WeightType;

public class Lift {

	private String name;
	private int sets;
	private int reps;
	private Weight weight;

	public Lift() {
		name = "Lift name";
		sets = 3;
		reps = 5;
		weight = new Weight(WeightType.Pounds, 0);
	}

	public Lift(String name, int sets, int reps, Weight weight) {
		super();
		this.name = name;
		this.sets = sets;
		this.reps = reps;
		this.weight = weight;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getSets() {
		return sets;
	}

	public void setSets(int sets) {
		this.sets = sets;
	}

	public int getReps() {
		return reps;
	}

	public void setReps(int reps) {
		this.reps = reps;
	}

	public double getWeight() {
		return weight.getWeight();
	}

	public void setWeight(Weight weight) {
		this.weight = weight;
	}

	public void changeWeightType(WeightType type){
		weight.changeType(type);
	}
	
	
	
	@Override
	public boolean equals(Object o) {
		if (!(o instanceof Lift)) {
			return false;
		}

		Lift otherLift = (Lift) o;

		return otherLift.name.equals(this.name) && otherLift.reps == this.reps
				&& otherLift.sets == this.sets
				&& otherLift.weight.getWeight() == this.weight.getWeight();

	}
	//http://stackoverflow.com/questions/113511/hash-code-implementation
	@Override
	public int hashCode() {
		int result = 17;
		result = 37 * result + reps;
		result = 37 * result + sets;
		result = 37 * result + name.hashCode();
		result = 37 * result + (weight == null ? 0 : 1);
		return result;
	}

}
